<h1>Services</h1>

<?php
  echo CHtml::link(CHtml::image(Yii::app()->request->baseUrl.'/images/icons/icon_add.jpg') . 'Add new service', array('service/create'));
  $this->widget('zii.widgets.grid.CGridView', array(
    'dataProvider'=>$dataProvider,
    'ajaxUpdate'=>true,
    'columns'=>array(
      array(
        'header'=>'No.',
        'value'=>'$this->grid->dataProvider->pagination->currentPage * $this->grid->dataProvider->pagination->pageSize + ($row+1)',
      ),
      'name_en',
      'short_description_en',
      array(
        'name' => 'Collapse Content',
        'type' => 'raw',
        'value' => 'CHtml::link("List (" . $data->serviceTopicsCount . ")",Yii::app()->createUrl("serviceTopic/list/serviceId/$data->id"))'
      ),      
      array(
        'name' => 'Photo',
        'type' => 'raw',
        'value' => 'CHtml::link("List (" . $data->countPhoto . ")",Yii::app()->createUrl("slide/list/modelName/service/modelId/$data->id"))'
      ),       
      array(
        'header'=>'Enable',
        'class'=>'CButtonColumn',
        'template'=>'{enable} {disable}',
        'buttons'=>array(
          'enable' => array(
            'imageUrl' => Yii::app()->request->baseUrl.'/images/icons/icon_enable.jpg',
            'visible'=>'$data->status == "A"',
            'url'=>'Yii::app()->createUrl("service/updateStatus", array("id"=>$data->id))',
            'click'=>'function(){if (confirm("Do you want to disable this item?")){return true; }else { return false;}}',
          ),
          'disable' => array(
            'imageUrl' => Yii::app()->request->baseUrl.'/images/icons/icon_disable.jpg',
            'visible'=>'$data->status == "I"',
            'url'=>'Yii::app()->createUrl("service/updateStatus", array("id"=>$data->id))',
            'click'=>'function(){if (confirm("Do you want to enable this item?")){return true; }else { return false;}}',
          )
        ),
      ),
      array(
        'header'=>'Edit',
        'class'=>'CButtonColumn',
        'template'=>'{update}',
      ),
      array(
        'header'=>'Delete',
        'class'=>'CButtonColumn',
        'template'=>'{delete}',
        'buttons'=>array
        (
					'delete' => array(),        	
        )
      ),
    ),
  )); ?>
